<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!-- 导入头部head，js内容 -->
<jsp:include page="../include_javascript_head.jsp"/>
<!-- 导入头部标题栏内容 -->

<base >
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>demo</title>
	<link rel="stylesheet" href="../WEB-INF/pages/css/bootstrap.min.css" />
	<link rel="stylesheet" href="../../css/common.css" />
	<link rel="stylesheet" href="../../css/welcome.css" />
	<link rel="stylesheet" href="../../css/jquery.ptTimeSelect.css" /><!-- 日历样式 -->
	<script type="text/javascript" src="../js/jquery-1.8.3.min.js" ></script>
	<script type="text/javascript" src="../../js/common.js"></script>
</head>
<body>
<!-- 弹框开始  -->
<div class="zhy_zhezhao_pop" style="display: none;"></div>
<!--实名认证用户没有权限-->
<div class="zhy_popa create_site_1 " style="width: 450px;margin-left: -225px;">
	<p class="color66">温馨提示<span class="pull-right close_icon" onclick="hidePop()"></span></p>
	<div class="pop_content text-center">
		<p>尊敬的${accountName}，您的服务站创建权限已用完 </p>
		<p>如需创建更多的服务站，请前往“应用市场”->“购买管理”中购买</p>
		<div class="operate_btn pull-right">
			<a class="btn cancle_yes" href="/cloud-portal/order/add_licence_max?moduleCode=multisite" >立即购买</a>
			<button type="button" class="btn cancel" onclick="hidePop()">关闭</button>
		</div>
	</div>
</div>

<div class="zhy_popa zhy_popa_cancel" style="width: 450px;margin-left: -225px;display: none;">
	<p class="color66">提示<span class="pull-right close_icon" onclick="hidePopC()"></span></p>
	<div class="pop_content">
		<p>确定要删除所选数据吗?</p>
		<div class="operate_btn pull-right">
			<button type="button" class="btn cancle_yes">确定</button>
			<button type="button" class="btn cancle_btn" onclick="hidePopC()">取消</button>
		</div>
	</div>
</div>
<!--没有实名认证用户-->
<div class="zhy_popa create_site_2 " style="width: 450px;margin-left: -225px;">
	<p class="color66">温馨提示<span class="pull-right close_icon" onclick="hidePop()"></span></p>
	<div class="pop_content text-center">
		<p>尊敬的${accountName}，您暂时没有创建服务站的权限 </p>
		<p>如需创建服务站，请及时进行实名认证</p>
		<div class="operate_btn pull-right">
			<button type="button" class="btn cancle_yes" >立即认证</button>
			<button type="button" class="btn cancel" onclick="hidePop()">关闭</button>
		</div>
	</div>
</div>
<!--弹框结束-->

<div class="main_content " >
	<div class="col-xs-12 col-sm-12 ">
		<div class="site_toggle_title">
			<div class="nav_head ">
				<ul>
					<!--<li class="" onclick="window.location.href='/cloud-statistics/station/displaypage/main'"  >服务站总览</li>-->
					<li class="on">服务站列表</li>
				</ul>
			</div>
			<div style="height: 20px; background: #edf0f2;"></div>
		</div>

		<div class="list_page div_bordered" >
			<div class="panel panel-default" >
				<!-- Default panel contents -->
				<div class="panel-heading" >
					<form class="form-inline pl20" role="form">
						<div class="form-group" >
							<div id="jsAddress_0"  class="selectbox_s">
								<input type="hidden" class="province" value="-1"/>
								<input type="hidden" class="city" value="-1"/>
								<input type="hidden" class="area" value="-1"/>
								<span class="" for="">省份：</span>
								<div name="province" type="selectbox"  class="btn-group inline "></div>
								<span class="" for="">城市：</span>
								<div name="city" type="selectbox"  class="btn-group inline"></div>
								<span class="" for="">区县：</span>
								<div name="area" type="selectbox"  class="btn-group inline"></div>
							</div>
						</div>
						<button type="button" class="btn btn_shanxuan" id="queryButton">搜索</button>
						<div class="pull-right text-right mr15">
								<span class="colorblue ">
									<a class="btn_blueg2" onclick="addStPreEvt()" href="serviceStationAdd.jsp">+创建服务站</a>
								</span>
						</div>
					</form>
				</div>
				<!-- 总条数，分页使用 -->
				<table class="table table-bordered  table-hover ">
					<tHead>
					<tr>
						<th width="18%">服务站</th>
						<th width="15%">省份</th>
						<th width="15%">城市</th>
						<th width="15%">区县</th>
						<th>操作</th>
					</tr>
					</tHead>
					<tBody id="flushDIV">
					<c:forEach items="${ssList}" var="li">
						<tr>
							<td>${li.serviceStationName}</td>
							<td>${li.province}</td>
							<td>${li.city}</td>
							<td>${li.area}</td>
							<td>
								<span><a href="#" class="colorblue">详情</a></span>
								<span><a href="#" class="colorblue">修改</a></span>
								<span><a href="#" class="colorred delete">删除</a></span>
							</td>
						</tr>
					</c:forEach>
					</tBody>
				</table>
			</div>
			<!--分页-->
			<div class="row text-center">
				<div id="Pagination" class="pagination"></div>
			</div>
		</div>
	</div>
</div>
<!-- 省市区联动 s -->
<script type="text/javascript" src="../js/jquery.ganged.js" ></script>
<script type="text/javascript" src="../js/pro.js"></script><!--  省市区的json数据 -->
<script type="text/javascript" src="../js/jquery.pagination.js"></script>

<script>
    var hasStation='${hasStation}';
    var maxStation='${businessStatus.stationCount}';
    //创建服务站事件
    function addStPreEvt(){

        window.location.href = "/cloud-portal/station/addpre";
    }
    //在子页面显示弹框
    function showPopC(obj,className,id){
        $(".zhy_zhezhao_pop").show();
        var top = document.body.scrollTop||document.documentElement.scrollTop;
        var this_h = $("." + className).height();
        var win_h = ($('html',parent.document).height()-this_h-100)/2
        $(".zhy_zhezhao_pop").height($("html").height());
        var this_h = $("." + className).height();
        top= top +win_h;
        $("." + className).css("top", top).show().siblings(".zhy_popa").hide();
    }
    // 隐藏修改弹框
    function hidePop() {
        $(".zhy_zhezhao_pop").hide();
        $(".zhy_popa").hide();
    }
    //省市区联动 调用
    $('#jsAddress_0').ganged({'data': provinceList, 'width': 111, 'height': 32});

    //////////////////////////////////////////////////////////////
    function showStationChange(className,obj){
        showPopStation(obj,className);

        InitTable(0);
    }

    function initPage(pageIndex,pageSize,total){
        //分页，PageCount是总条目数，这是必选参数，其它参数都是可选
        $("#Pagination").pagination(total, {
            callback: function(){return true;},
            link_to:"javascript:InitTable(__id__)",
            prev_text: '上一页',       //上一页按钮里text
            next_text: '下一页',       //下一页按钮里text
            items_per_page: pageSize,  //显示条数
            num_display_entries: 6,    //连续分页主体部分分页条目数
            current_page: pageIndex-1,   //当前页索引
            num_edge_entries: 2        //两侧首尾分页条目数
        });

    }
    //请求数据
    function InitTable(pageIndex) {

        var province = $("input[name='province']").val();
        var city = $("input[name='city']").val();
        var area = $("input[name='area']").val();
        pageIndex = parseInt(pageIndex)+1;

        $.ajax({
            type: 'POST',
            url: "${ctx}/station/accountStationList",
            data: {
                province:province,
                city:city,
                area:area,
                page:pageIndex,
                pageSize:10
            },
            dataType: "json",
            success:function(data){
                var stations=data.serviceStations;
                if(stations!=null&&stations.length>0&&data.totalCount>0){
                    $("#flushDIV").empty();
                    for(var i=0;i<stations.length;i++){
                        var $tr =$('<tr><td >'+stations[i].serverStationName+'</td>'
                            +'<td >'+stations[i].provinceName+'</td>'
                            +'<td >'+stations[i].cityName+'</td>'
                            +'<td >'+stations[i].areaName+'</td>'
                            +'<td><span><a href="/cloud-portal/station/viewstation?stationCode='+stations[i].serverStationCode+'" class="colorblue">修改</a></span></td>'
                            +'</tr>');
                        $("#flushDIV").append($tr)
                    }
                    initPage(data.pageNum,data.pageSize,data.totalCount);
                }else{
                    $("#flushDIV").html('<tr><td colspan="5" style="text-align: center">暂无数据</td></tr>');
                    $("#Pagination").empty();
                }

            }
        });
    }
    //InitTable(0);

    //搜索框
    $("#queryButton").click(function(){
        InitTable(0);
    });
</script>
</body>



